app.controller('chart1Ctrl',['$scope','$http',function($scope,$http){
    // $http({
    //     method: 'POST',
    //     url: 'http://10.3.247.64:7003/srp/md/md-pdata!findHis.action?qm.company=GF&Authorization='
    // }).then(function(data){
    //     console.log(data)
    // },function(data){
    //     console.log(data)
    // })
    $scope.data = [{week:'',year:''}]
    var token = localStorage.getItem('token');
    $http({
        method: "POST",
        url: mainUrl+'/md/md-pdata!findHis.action',
        params: {
            'Authorization': token,
            /*'qm.flag' : 1*/
            'qm.company':'GF'
        }
    }).then(
        function(data, status, headers, config){
            console.log(data)
            var option = {
                grid:{
                    top: "15%",
                    height: "60%",
                },
                legend: {
                    top: "6rem",
                    data: ["安全生产预警指数","安全生产预测值"]
                },
                tooltip: {
                    trigger: 'axis'
                },
                xAxis: {
                    type: 'category',
                    boundaryGap: false,
                    data: data.data.items[0].week,
                    axisLabel: {
                        show: true,
                        textStyle: {
                            color: '#FFA27E'
                        }
                    }
                },
                series:[{
                    name: "安全生产预警指数",
                    type: "line",
                    data: data.data.items[0].spi
                },
                    {
                        name: "安全生产预测值",
                        type: "line",
                        data: data.data.items[0].spifor
                    }],
                yAxis: {
                    type: 'value'
                },
                dataZoom: [{
                    type: 'inside',
                    start: 70,
                    end: 100
                },{
                    type: "slider",
                    show: true,
                    bottom: "5rem",
                    handleSize: 30,
                    start: 70,
                    end: 100,
                    handleIcon: 'M10.7,11.9v-1.3H9.3v1.3c-4.9,0.3-8.8,4.4-8.8,9.4c0,5,3.9,9.1,8.8,9.4v1.3h1.3v-1.3c4.9-0.3,8.8-4.4,8.8-9.4C19.5,16.3,15.6,12.2,10.7,11.9z M13.3,24.4H6.7V23h6.6V24.4z M13.3,19.6H6.7v-1.4h6.6V19.6z',
                    handleSize: '80%',
                    handleStyle: {
                        color: '#ffffff',
                        shadowBlur: 3,
                        shadowColor: 'rgba(0, 0, 0, 0.6)',
                        shadowOffsetX: 2,
                        shadowOffsetY: 2
                    }
                }]
            };
            var chart1 = echarts.init(document.getElementById($scope.$$childTail.id));
            chart1.setOption(option);
            mui.hideLoading();
            // document.getElementsByClassName('mui-switch-blue').addEventListener
        },function(data, status, headers, config){

        }
    );
    // $http.post('http://10.3.247.64:7003/srp/md/md-pdata!findHis.action?'+token).then(function(data){
    //
    //     console.log($scope.$$childTail.id);
    //
    // }, function(data){
    //     console.log(data)
    // });
}])